//axios 实例配置
import axios from 'axios'


//创建一个axios实例
const service = axios.create({
  //请求超时时间
  timeout:3000
})

//添加请求拦截器
service.interceptors.request.use(
  config => {
    return config
  },
  err => { 
    console.log(err);
  }
)
//添加响应拦截器
service.interceptors.response.use(
  //获取响应
  response => { 
    let res = {}
    //可以进行判断status=200 404等时页面跳转情况
    res.status = response.status
    res.data = response.data
    return res
  },err => console.log(err)
)

export default service